<template>
  <div class="home">
    <el-form :model="form" ref="form" label-width="80px">
      <dynamic-form-item
        v-for="(item, i) of config"
        :key="i"
        v-model="form[item.key]"
        :type="item.type"
        :title="item.title"
      ></dynamic-form-item>
    </el-form>
    <el-button type="primary" @click="checkData()">1111</el-button>
  </div>
</template>

<script>
export default {
  name: "Home",
  data() {
    return {
      form: {},
      test: "1",
      formElement: [],
      config: [
        {
          title: "姓名",
          key: "act_name",
          type: "dy-input"
        },
        {
          title: "电话",
          key: "act_phone",
          type: "dy-input"
        }
      ]
    };
  },
  created() {
    this.initForm();
  },
  methods: {
    initForm() {
      this.config.map((item) => {
        this.$set(this.form, item.key, "");
      });
    },
    checkData() {
      console.log(this.form);
    }
  }
};
</script>
